package com.qall.onlie_code.process;


import com.qall.onlie_code.process.entity.CodeEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class ProcessController {

    @Resource
    private CodeProcess codeProcess;

    @PostMapping("/exec")
    @ResponseBody
    public String execFunction(@RequestBody  CodeEntity code) {
        System.out.println(code.getBaseCode());
        String codeString=code.getCode();
        return codeProcess.process(codeString);
    }
    @GetMapping("/index")
    public String index(){
        return "index";
    }

}
